package services;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import model.ReservasPersonas;
import repository.GenericConector;

public class ReservasPersonasServices {
	
	private List<ReservasPersonas> lista;
	private GenericConector gc;
	private ResultSet rs;
	
	public List<ReservasPersonas> GetReservasPersonasAll() throws SQLException{
		gc = new GenericConector();
		rs = gc.getResultSet("SELECT * FROM reservaspersonas");
		lista = new ArrayList<ReservasPersonas>();
		
		while(rs.next()){
			lista.add(new ReservasPersonas(rs.getInt("idreserva"),rs.getInt("idcliente")));
		}
		
		return lista;
	}
	
	public void DeleteClientesFromReservas(int idcliente,int idreserva ) throws SQLException{
		gc = new GenericConector();
		gc.ejecutar("Delete From Reservas_Personas Where idCliente = " + idcliente + "AND idreserva = " + idreserva);
	}

}
